package com.compunit.composite.core.interfaces;

import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;

import javax.naming.OperationNotSupportedException;

/**
 * <code>IPackager</code> defines the interface of an
 * foundation level utility unit that is responsible
 * for packaging up a primitive component with its
 * implementations and mappings into corresponding class,
 * resources jar files and cx file.
 * <p>
 * <code>IPackager</code> does not support the parent-
 * defined <code>export</code> methods. Instead the
 * <code>seal</code> method should be used to seal up
 * a component package.
 *
 * @author Yi Wang (Neakor)
 * @version Creation date: 11-12-2009 12:05 EST
 * @version Modified date: 12-05-2009 13:51 EST
 */
public interface IPackager extends IClassExporter, IResourceExporter {

	/**
	 * Seal the component by outputting the corresponding
	 * class, cx and resources jar files to the given
	 * directory.
	 * @param directory The <code>URL</code> of the
	 * destination directory.
	 * @throws URISyntaxException If given URL is invalid.
	 * @throws IOException If file handling failed.
	 * @throws OperationNotSupportedException If internal
	 * exporters failed to execution export process.
	 */
	public void seal(final URL directory) throws URISyntaxException, IOException, OperationNotSupportedException;
	
	/**
	 * Set the primary component implementation.
	 * @param primary The <code>Class</code> object of
	 * the primary component implementation.
	 */
	public void setPrimary(final Class<?> primary);
	
	/**
	 * Set the name of this component.
	 * @param name The <code>String</code> name.
	 */
	public void setName(final String name);
	
	/**
	 * Retrieve the component name.
	 * @return The <code>String</code> name.
	 */
	public String getName();
}
